//#pragma once
#ifndef EXTDATA_H_
#define EXTDATA_H_

#include <vector>
#include <map>
//#include <cstdarg>
//#include <utility>

enum CH_DIRECTION
{
	NONE,
	INBOUND,
	OUTBOUND
};

enum CALLSTATE
{
	INIT,
	EARLY,
	ACTIVE
};

class CCallInfo
{
public:
	CCallInfo()
	{
		memset( uuid_a_leg, 0, 255 );
		memset( uuid_b_leg, 0, 255 );
		memset( CL_caller, 0, 255 );
		memset(CL_callee, 0, 255 );
		memset( CL_create_time, 0, 255 );
		memset( CL_end_time,0, 255 );
	}
	~CCallInfo() {}

public:
	char	uuid_a_leg[255];
	char	uuid_b_leg[255];
	char	CL_caller[255];
	char	CL_callee[255];
	char	CL_create_time[255];
	char	CL_end_time[255];

};


extern std::map<char* , CCallInfo*> g_CallInfo;

//class CChannelInfo
//{
//public:
//	CChannelInfo()
//		:ch_direct(NONE)
//		//,ch_bhitdialplan(false)
//		,ch_caller(0)
//		,ch_callee(0)
//	{
//		memset(ch_uuid, 0, 255 );
//	}
//	~CChannelInfo()
//	{
//		
//	}
//
//public:
//	CH_DIRECTION	ch_direct;
//	char			ch_uuid[255];
//	//bool			ch_bhitdialplan;
//	int				ch_caller;
//	int				ch_callee;
//
//};

enum REG_STATUS
{
	IDLE=0x1,
	BUSY,
	BLOCKING
};

class CExtData
{
public:
	CExtData()
		:u_breg(false)
		,u_state(IDLE)
		,u_port(0)
	{
		memset( u_id, 0, 255);
		memset( u_url, 0, 1024);
		memset( u_regIP, 0, 255 );
		memset( u_regStatus, 0, 255 );
		memset( u_agent, 0, 255 );
	}
	~CExtData(void)
	{

	}

public:
	char						u_id[255];
	char						u_url[1024];
	bool						u_breg;
	char						u_regIP[255];
	int							u_port;
	char						u_regStatus[255];
	char						u_agent[255];
	REG_STATUS					u_state;

};


extern std::map<int, CExtData*>			g_ExtData;
//extern std::map<int, CExtData*>::iterator	g_Iter;

//int a = 10;





//extern std::map<int, CChannelInfo*>			g_ChData;
//extern std::map<int, CChannelInfo*>::iterator	g_Chiter;

extern REG_STATUS ext_statusquery(int& key);


#endif